<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center forgetPasw_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub forgetPasw_fd0_0'>
          <view class='flex flex-wrap align-center forgetPasw_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  forgetPasw_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
          </view>
          <view class='flex flex-wrap align-center justify-end forgetPasw_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-wrap align-center justify-center benben-flex-layout forgetPasw_flex_1">
        <image class='forgetPasw_fd1_0' mode="aspectFit" :src='STATIC_URL+"22.png"'></image>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center forgetPasw_flex_2">
        <view>
          <benben-flex-tabs class-name='forgetPasw_benbenTabsfd2_0' v-model="tabls" ref="benben_tabsfd2_0"
            select-mark="benben_tabsfd2_0" key="benben_tabsfd2_0" :open-title-type='false' :open-sticky='true' :top='0'
            :is-show-content='false' :scrollspy='false' :tabs-info.sync="tabsInfofd2_0">

            <scroll-view @scroll="tabsInfofd2_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd2_0"
              class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left.sync="tabsInfofd2_0.moveX"
              scroll-with-animation="all .3s ease">
              <view class="benben-tabs-content" id="benben_tabsfd2_0-content">
                <view id="benben_tabsfd2_0-title" class="benben-tabs-title flex align-center flex ">
                  <view
                    :class="{ 'checkTitlefd2_0': tabls == 'mobile', 'flex flex-wrap align-center forgetPasw_titlefd2_0_c3': true }"
                    @tap="tabls = 'mobile'" :id="`benben_tabsfd2_0-title-item-${'mobile'}`">

                    <text>{{$t('手机号登录')}}</text>

                  </view>
                  <view
                    :class="{ 'checkTitlefd2_0': tabls == 'email', 'flex flex-wrap align-center forgetPasw_titlefd2_0_c4': true }"
                    @tap="tabls = 'email'" :id="`benben_tabsfd2_0-title-item-${'email'}`">

                    <text>{{$t('邮箱号登录')}}</text>

                  </view>
                </view>
                <view :style="{ left: tabsInfofd2_0.lineleft, maxWidth: tabsInfofd2_0.lineWidth ,}"
                  id="benben_tabsfd2_0-line" class="benben-tabs-line flex benben-flex-tabs-line forgetPasw_linefd2_0">
                </view>
              </view>
            </scroll-view>

          </benben-flex-tabs>

        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout forgetPasw_flex_3">
        <view class='flex flex-wrap align-center forgetPasw_fd3_0' v-if=" tabls=='mobile'">
          <image class='forgetPasw_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"23.png"'></image>
          <view class='flex flex-wrap align-center' @click.stop="pickerDiy1704874099380=true">
            <text class='forgetPasw_fd3_0_c1_c0'>+{{area_code}}</text>
            <image class='forgetPasw_fd3_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"29.png"'></image>
          </view>
          <input class='flex-sub forgetPasw_fd3_0_c2' type="number" :placeholder="$t('请输入手机号')" confirm-type="done"
            :maxlength="20" placeholder-style="color:rgba(102, 102, 102, 1);font-size:28rpx"
            v-model="dataObj.actount" />
        </view>
        <view class='flex flex-wrap align-center forgetPasw_fd3_0' v-if=" tabls=='email'">
          <image class='forgetPasw_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"27.png"'></image>
          <input class='flex-sub forgetPasw_fd3_0_c2' type="text" :placeholder="$t('请输入邮箱号')" confirm-type="done"
            :maxlength="-1" placeholder-style="color:rgba(102, 102, 102, 1);font-size:28rpx" v-model="dataObj.mail" />
        </view>
        <view class='flex flex-wrap align-center forgetPasw_fd3_0'>
          <image class='forgetPasw_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"28.png"'></image>
          <input class='flex-sub forgetPasw_fd3_0_c2' type="number" :placeholder="$t('请输入验证码')" confirm-type="done"
            :maxlength="4" placeholder-style="color:rgba(102, 102, 102, 1);font-size:28rpx" v-model="code" />
          <benben-send-verification-code ref="vCode1702822799939" class='forgetPasw_fd3_2_c2' :after-text="$t('后重新获取')"
            :areacode="area_code" :before-text="$t('获取验证码')" :emptye-text="$t('请输入账号')" :validate-text="$t('请输入正确账号')"
            account-type='phone' :auto='true' type='2' :phone="dataObj.actount"
            v-if=" tabls=='mobile'"></benben-send-verification-code>
          <benben-send-verification-code ref="vCode1703554782909" class='forgetPasw_fd3_2_c2' :after-text="$t('后重新获取')"
            :before-text="$t('获取验证码')" :emptye-text="$t('请输入邮箱号')" :validate-text="$t('请输入正确邮箱号')" account-type='email'
            :auto='true' type='2' :phone="dataObj.mail" v-if=" tabls=='email'"></benben-send-verification-code>
        </view>
        <view class='flex flex-wrap align-center forgetPasw_fd3_0'>
          <image class='forgetPasw_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"24.png"'></image>
          <benben-flex-password-diy v-model="dataObj.paswarld" class-name="flex flex align-center forgetPasw_fd3_3_c1"
            :placeholder="$t('请输入密码(6~12位字母+数字)')" :maxlength="12" :default-type='true'
            placeholder-style="color:#999;font-size:28rpx">
            <template #show>
              <text class='fu-iconfont2  forgetPasw_fd3_3_c1_icon1' data-type="show">&#xE837;</text>
            </template>
            <template #hide>
              <text class='fu-iconfont2  forgetPasw_fd3_3_c1_icon2' data-type="hide">&#xEBCC;</text>
            </template>
          </benben-flex-password-diy>
        </view>
        <view class='flex flex-wrap align-center justify-center forgetPasw_fd3_4'>
          <button class='forgetPasw_fd3_4_c0' @tap.stop="sorgotPasswordFunc()">确定</button>
        </view>
      </view>

      <!---flex布局flex布局结束-->

      <benben-picker ref="benbenWritePickerCodepicker2" :visible.sync="pickerDiy1704874099380" :value.sync='area_code'
        :options='areaList' mode='selector' :mask-show='true' :timeout='true' :picker-height='88' default-type='quhao'
        :default-props='{"label":"guojia","value":"quhao"}'>
        <template #picker-header>
          <view class='flex flex-wrap align-center justify-between myProfile_picker2_0'>
            <text class='myProfile_picker2_0_c0' @tap="$refs.benbenWritePickerCodepicker2.cancel()">取消</text>
            <text>选择区号</text>
            <text class='myProfile_picker2_0_c2' @tap="$refs.benbenWritePickerCodepicker2.pickerConfirm()">确认</text>
          </view>
        </template>
      </benben-picker>
    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        "tabsInfofd2_0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "tabls": "mobile",
        "dataObj": {
          "actount": "",
          "mail": "",
          "paswarld": "",
          "is_tick": false
        },
        "code": "",
        areaList: [],
        area_code: '',
        pickerDiy1704874099380: false,
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.$api.post(global.apiUrls.post65ea6e2f5dcb9).then(res => {
        if (res.data.code == 1) {
          this.areaList = res.data.data
          this.area_code = this.areaList[0].quhao
        }
      })
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //忘记密码
      async sorgotPasswordFunc() {
        if (this.tabls == 'mobile') {
          if (!validate(this.dataObj.actount, 'require')) {
            this.$message.info(global.i18n.t('手机号不能为空'));
            return false;
          }
          // if (!validate(this.dataObj.actount, 'phone')) {
          //   this.$message.info(global.i18n.t('请输入正确的手机号'));
          //   return false;
          // }
        } else if (this.tabls == 'email') {
          if (!validate(this.dataObj.mail, 'require')) {
            this.$message.info(global.i18n.t('邮箱号不能为空'));
            return false;
          }
          if (!validate(this.dataObj.mail, 'email')) {
            this.$message.info(global.i18n.t('请输入正确的邮箱号'));
            return false;
          }
        }
        if (!validate(this.code, 'require')) {
          this.$message.info(global.i18n.t('验证码不能为空'));
          return false;
        }
        if (!validate(this.code, 'captcha')) {
          this.$message.info(global.i18n.t('请输入正确的验证码'));
          return false;
        }
        if (!validate(this.dataObj.paswarld, 'require')) {
          this.$message.info(global.i18n.t('密码不能为空'));
          return false;
        }
        if (!validate(this.dataObj.paswarld, 'password')) {
          this.$message.info(global.i18n.t('请输入密码(6~12位字母+数字)'));
          return false;
        }
        //请求方法
        //数据验证

        let data5caeeba9866aa = await this.$api.post(global.apiUrls.post5caeeba9866aa, {
          password: this.dataObj.paswarld,
          account: this.tabls == 'mobile' ? this.dataObj.actount : this.dataObj.mail,
          code: this.code,
          type: '2',
          account_type: this.tabls,
          quhao: this.area_code
        });

        if (data5caeeba9866aa.data.code != 1) {
          this.$message.info(data5caeeba9866aa.data.msg);
          return
        }


        this.$message.info(global.i18n.t('重置成功'));
        setTimeout(() => {
          this.toLoginDiy();
        }, 500)
      }
    }
  };
</script>
<style lang="scss" scoped>
  .codeLogin_fd1_3_c1_c1 {
    width: 14rpx;
    height: 8rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .codeLogin_fd1_3_c1_c0 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 34rpx;
    margin: 0rpx 10rpx 0rpx 0rpx;
  }

  .codeLogin_fd1_3_c1 {
    margin: 0rpx 24rpx 0rpx 0rpx;
  }

  .myProfile_picker2_0_c2 {
    color: rgba(100, 80, 235, 1);
  }

  .myProfile_picker2_0_c0 {
    color: var(--benbenFontColor2);
  }

  .myProfile_picker2_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
    border-radius: 25rpx 25rpx 0rpx 0rpx;
    background-size: 100% auto !important;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: url(image-path('21.png')) no-repeat, #F7F3ED;
    background-size: 100% auto;
  }

  .forgetPasw_flex_0 {
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
  }

  .forgetPasw_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .forgetPasw_fd0_0_c0 {
    width: 120rpx;
  }

  .forgetPasw_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .forgetPasw_flex_1 {
    padding: 3rpx 0rpx 0rpx 0rpx;
  }

  .forgetPasw_fd1_0 {
    width: 136rpx;
    height: 141rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .forgetPasw_flex_2 {
    margin: 87rpx 0rpx 0rpx 0rpx;
  }

  .forgetPasw_titlefd2_0_c4 {
    margin: 0rpx 0rpx 0rpx 48rpx;
  }

  .forgetPasw_titlefd2_0_c3 {
    margin: 0rpx 0rpx 0rpx 64rpx;
  }

  .forgetPasw_linefd2_0 {
    background: rgba(145, 47, 34, 1);
    width: 45rpx;
    height: 12rpx;
    top: 80rpx;
    background-size: 100% auto !important;
    border-radius: 44rpx;
  }

  .checkTitlefd2_0 {
    font-weight: 700 !important;
    font-size: 28rpx !important;
    color: #333 !important;
  }

  ::v-deep .forgetPasw_benbenTabsfd2_0 {
    width: 750rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
    font-size: 28rpx;
    font-weight: 500;
    color: #666666;
  }

  .forgetPasw_flex_3 {
    padding: 0rpx 64rpx 0rpx 64rpx;
    margin: 55rpx 0rpx 0rpx 0rpx;
  }

  .forgetPasw_fd3_4_c0 {
    background: rgba(145, 47, 34, 1);
    border-radius: 44rpx;
    width: 616rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
  }

  .forgetPasw_fd3_4 {
    margin: 80rpx 0rpx 0rpx 0rpx;
  }

  .forgetPasw_fd3_3_c1_icon2 {
    width: 88rpx;
    line-height: 88rpx;
    text-align: center;
    font-size: 40rpx;
  }

  .forgetPasw_fd3_3_c1_icon1 {
    text-align: center;
    font-size: 40rpx;
  }

  ::v-deep .forgetPasw_fd3_3_c1 {
    width: 543rpx;
    font-size: 28rpx;
    height: 32rpx;
    color: #333;
  }

  .forgetPasw_fd3_2_c2 {
    line-height: 42rpx;
    text-align: center;
    font-size: 27rpx;
    color: rgba(51, 51, 51, 1);
  }

  .forgetPasw_fd3_0_c2 {
    font-size: 28rpx;
    color: #333;
  }

  .forgetPasw_fd3_0_c1_c1 {
    width: 26rpx;
    height: 26rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 24rpx 0rpx 0rpx;
  }

  .forgetPasw_fd3_0_c1_c0 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 14rpx;
  }

  .forgetPasw_fd3_0_c0 {
    width: 36rpx;
    height: 36rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 32rpx 0rpx 0rpx;
  }

  .forgetPasw_fd3_0 {
    border-bottom: 1px solid rgba(232, 229, 216, 1);
    padding: 32rpx 0rpx 32rpx 0rpx;
  }
</style>
